﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BluePortal.Framework
{
    public class Log
    {
        public enum Layers {Web, API, Services, Framework};

        public static void LogInfo (string composant, string method, string message)
        {
            DoLog(composant, method, message, -1, System.Diagnostics.TraceEventType.Information);
        }

        public static void LogError(string composant, string method, Exception ex)
        {
            DoLog(composant, method, ex.Message, -1, System.Diagnostics.TraceEventType.Error);
        }
        public static void LogError(string composant, string method, int errorType, Exception ex)
        {
            if (ex != null)
                DoLog(composant, method, ex.Message + "\n" + ex.StackTrace, errorType, System.Diagnostics.TraceEventType.Error);
        }

        public static void LogError(string composant, string method, string message)
        {
            DoLog(composant, method, message, -1, System.Diagnostics.TraceEventType.Error);
        }

        public static void LogError(string composant, string method, string message, int errorType)
        {
            DoLog(composant, method, message, errorType, System.Diagnostics.TraceEventType.Error);
        }

        public static void DoLog(string composant, string method, string message, int errorType, System.Diagnostics.TraceEventType type)
        {
            //TraceLogEntry log = new TraceLogEntry();
            //log.Message = message;
            //log.Categories.Add("bluePortal");
            //log.EventId = errorType;
            //log.TypeName = composant;
            //log.MethodName = method;
            //log.Severity = type;
            //Logger.Write (log); 
        }
    }
}
